package com.lemon.ai.socket.packets.spiritgame.xls2Object.generator;

import java.io.File;
import java.io.FileInputStream;

import com.lemon.ai.socket.packets.spiritgame.model.generator.AbstractGenerator;
import com.lemon.ai.socket.packets.spiritgame.model.utils.FileUtils;
import com.lemon.ai.socket.packets.spiritgame.xls2Object.Constent;

public class ASClassModelGenerator extends AbstractGenerator {

	private static FileUtils fu = new FileUtils();
	
	public ASClassModelGenerator() {
		super("asClassModelTemp.txt");
		
		try {
			this.prop.load(new FileInputStream(new File(System
					.getProperty("user.dir")
					+ "\\templetConfig.properties")));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void generate(Constent c) {
		if(!c.isClientNeed()) {
			return;
		}
		String fname = super.prop.getProperty("dir")
				+ super.prop.getProperty("package").replace(".", "\\")
				 + "\\as\\model\\" + c.className + "Model"
				+ ".as";
		
		String temp = super.temp.replaceAll("CLASS_NAME", c.className);
		fu.write(fname, temp);
	}

}
